FILE: TAPE_INTE:TOS HEWLETT-PACKARD: TAPE_INTERFACE (c) Coleco 1983 Confidential Tue, 15 May 1984, 20:30 Page 1 1 ;^Z80^ 3 ;NAME ^Rev 02 - GPB^ 4 5 De_TAPE_INTERFACE MACRO ;Header Rev. 5 6 .GOTO Ede_TAPE_INTERFACE 7 8 Project: TAPE, C101 9 10 ****************************** 11 * * 12 * TAPE_INTERFACE DTT * 13 * * 14 ****************************** 15 16 Rev History 17 Rev. Date Name Change 18 2 11/2/83 GPB CHANGED RANGE TO RANGE_ ( duplicate symbol problem) 19 1 9/13/83 DTT CHANGED TO ALLOW ERROR RETIRES 20 0 7/5/83 DTT Initial Pseudo Code 21 22 Function: 23 REQUEST READS AND WRITES AS DEFINED IN OCB. 24 REQUESTS ABORT_TAPE. 25 TEST STATUS OF TAPE REQUEST. 26 27 28 Ede_TAPE_INTERFACE MEND 29 Pseudo_code_TAPE_INTERFACE MACRO ;Pseudocode macro area 30 BEGIN: 31 STORE OVERLAY_NUMBER 32 HL := POINTER TO OCB := OVERLAY_NUMBER*5 + OVERLAY_TABLE_POINTER 33 MOVE OCB TO CSA 34 IF WRITE THEN 35 SEND WRITE_COMMAND 36 ELSE 37 SEND READ_COMMAND 38 ENDIF 39 END 40 .GOTO Ep_TAPE_INTERFACE 41 42 43 44 Ep_TAPE_INTERFACE MEND 45 46 ;Subroutines called 47 ; EXT 48 49 ;Subroutines defined 50 GLOBAL TEST_TAPE 51 GLOBAL ABORT_TAPE 52 GLOBAL LOAD_OVERLAY 53 GLOBAL WRITE_OVERLAY 54 GLOBAL CALC_OCB_ADDR 55 GLOBAL WRITE_BLOCKS 56 GLOBAL LOAD_BLOCKS FILE: TAPE_INTE:TOS HEWLETT-PACKARD: TAPE_INTERFACE (c) Coleco 1983 Confidential Tue, 15 May 1984, 20:30 Page 2 57 GLOBAL BLOCK_IO 58 ; GLOBAL 59 60 ;Operating system calls 61 ; EXT 62 63 ;Inputs/Outputs passed in registers 64 ; A = OVERLAY NUMBER 1 thru N 65 ; A <> 0 = ERROR 66 67 ;External data areas used 68 EXT OCB_PTR ;POINTER TO OVERLAY CONTROL TABLE 69 70 ;Global data areas defined 71 GLOBAL OVERLAY_NUMBER 72 GLOBAL TAPE_STATE 73 GLOBAL CSA 74 GLOBAL XFER_ADDR 75 GLOBAL BLOCK_NUM 76 GLOBAL RANGE_ 77 ; GLOBAL 78 79 ;Local equates 80 ; EQU 81 82 ;Global equates 83 GLOBAL READ_TAPE 84 GLOBAL WRITE_TAPE 85 GLOBAL KILL_TAPE 86 0081 READ_TAPE EQU 81H 87 0082 WRITE_TAPE EQU 82H 88 0087 KILL_TAPE EQU 87H 89 ; INCLUDE File_name:userid 90 91 92 PROG 93 94 ; TEST FOR COMPLETION OF IO REQUEST 95 0000' TEST_TAPE: 96 0000' 3A 0200" LD A,(CSA) 97 0003' B7 OR A 98 0004' C3 3D00' JP EXIT_TAPE 99 ;* 100 ;* 101 ;* 102 0007' ABORT_TAPE: 103 0007' 3E 87 LD A,KILL_TAPE 104 0009' 32 0200" LD (CSA),A 105 000C' C3 3D00' JP EXIT_TAPE 106 ;* 107 ;* 108 109 000F' CALC_OCB_ADDR: 110 000F' 3D DEC A ;ADDR = OCB_TABLE(OV_NUM-1*5) 111 0010' 4F LD C,A ;GET THE OVERLAY NUMBER IN C 112 0011' 06 00 LD B,0 113 0013' 2A 0000# LD HL,(OCB_PTR) ;POINTER TO THE OCB TABLE FILE: TAPE_INTE:TOS HEWLETT-PACKARD: TAPE_INTERFACE (c) Coleco 1983 Confidential Tue, 15 May 1984, 20:30 Page 3 114 0016' 09 ADD HL,BC ;OCB_ADDR = OVERLAY_NUM*5 + START_OF_TABLE 115 0017' 09 ADD HL,BC 116 0018' 09 ADD HL,BC 117 0019' 09 ADD HL,BC 118 001A' 09 ADD HL,BC 119 001B' C9 RET 120 ;* 121 001C' WRITE_OVERLAY: 122 001C' 37 SCF ;SET CARRY FLAG IF WRITE INSTRUCTION! 123 001D' 18 01 JR LD_1 124 ;* 125 ;* 126 001F' LOAD_OVERLAY: 127 001F' B7 OR A ;RESET CARRY FLAG IF READ 128 ;* 129 ;* 130 0020' LD_1: 131 ; BEGIN (Ordinarily registers are restored; retain only the pushes and pops you need.) 132 ;* 133 ;* 134 ;* 135 0020' 32 0000" LD (OVERLAY_NUMBER),A ;FOR DEBUGGING PURPOSES 136 ;* 137 ;* 138 0023' F5 PUSH AF ;++++++++++++++++++++; 139 0024' CD 0F00' CALL CALC_OCB_ADDR ; 140 0027' F1 POP AF ;--------------------; ;SAVE THE CARRY FLAG IF SET 141 ;* 142 0028' 30 04 JR NC,LOAD_BLOCKS 143 144 002A' WRITE_BLOCKS: 145 002A' 3E 82 LD A,WRITE_TAPE ;WRITE INSTRUCTIONS GO HERE 146 002C' 18 02 JR BLOCK_IO 147 002E' LOAD_BLOCKS: 148 002E' 3E 81 LD A,READ_TAPE ;READ INSTRUCTIONS GO HERE 149 0030' BLOCK_IO: 150 0030' 11 0300" LD DE,CSA+1 ; ;POINT TO THE COMMAND STATUS AREA 151 0033' 01 0500 LD BC,5 ; ;NUMBER OF BYTES TO MOVE 152 0036' ED B0 LDIR 153 0038' 11 0200" LD DE,CSA 154 003B' 12 LD (DE),A ;SET THE COMMAND IN THE CSA BUFFER 155 003C' AF XOR A 156 GLOBAL EXIT_TAPE 157 003D' EXIT_TAPE: 158 003D' C9 RET 159 ;********************************************************************************************* 160 DATA 161 0000" 0001 OVERLAY_NUMBER DEFS 1 162 0001" 0001 TAPE_STATE DEFS 1 163 0002" 0006 CSA DEFS 6 164 0003" XFER_ADDR EQU CSA+1 165 0005" BLOCK_NUM EQU XFER_ADDR+2 166 0007" RANGE_ EQU BLOCK_NUM+2 FILE: TAPE_INTE:TOS HEWLETT-PACKARD: TAPE_INTERFACE (c) Coleco 1983 Confidential Tue, 15 May 1984, 20:30 Page 4 0 Error(s) Detected. 62 Program Bytes. 8 Data Bytes. 20 Symbols Detected. FILE: TAPE_INTE:TOS HEWLETT-PACKARD: TAPE_INTERFACE (c) Coleco 1983 Confidential Tue, 15 May 1984, 20:30 Page 5 Value Symbol Defined Referenced: 0007' ABORT_TAPE 102 51 0030' BLOCK_IO 149 57 146 0005" BLOCK_NUM 165 75 166 000F' CALC_OCB_ADDR 109 54 139 0002" CSA 163 73 96 104 150 153 164 003D' EXIT_TAPE 157 98 105 156 0087 KILL_TAPE 88 85 103 0020' LD_1 130 123 002E' LOAD_BLOCKS 147 56 142 001F' LOAD_OVERLAY 126 52 0000# OCB_PTR 68 113 0000" OVERLAY_NUMBER 161 71 135 0007" RANGE_ 166 76 0081 READ_TAPE 86 83 148 0001" TAPE_STATE 162 72 0000' TEST_TAPE 95 50 002A' WRITE_BLOCKS 144 55 001C' WRITE_OVERLAY 121 53 0082 WRITE_TAPE 87 84 145 0003" XFER_ADDR 164 74 165